<template>
  <div>
    <Header></Header>
    <div class="banner">
      <img src="@/static/images/decorate/banner.jpg" alt="" />
    </div>
    <div class="breadcrumb">
      <div>首页 / 装饰摆件</div>
    </div>
    <div class="search">
      <div class="search-box">
        <p>装饰摆件</p>
        <el-select v-model="selectValue" placeholder="排序方式">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
    </div>
    <div class="main">
      <ul>
        <li v-for="item in dataSource" :key="item.id">
          <img :src="require('@/static/images/decorate/' + item.img)" alt="" />
          <p class="title">{{ item.title }}</p>
          <p class="price">￥{{ item.price }}</p>
        </li>
      </ul>
    </div>
  </div>
  <Footer></Footer>
  <Tabbar></Tabbar>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import Header from '@/components/header/index.vue';
import Tabbar from '@/components/tabbar/index.vue';
import Footer from '@/components/footer/index.vue';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const mainData = require('@/mock/decorate/index.json');

export default defineComponent({
  components: {
    Header,
    Tabbar,
    Footer,
  },
  setup() {
    const options = [
      {
        label: '按价格升序排序',
        value: 1,
      },
      {
        label: '按价格降序排序',
        value: 2,
      },
      {
        label: '按好评升序排序',
        value: 3,
      },
      {
        label: '按好评降序排序',
        value: 4,
      },
    ];
    const selectValue = ref();
    const dataSource = mainData.data;
    return {
      options,
      selectValue,
      dataSource,
    };
  },
});
</script>

<style lang="scss" scoped>
.banner {
  width: 100%;

  img {
    width: 100%;
  }
}
.breadcrumb {
  width: 100%;
  border-bottom: 1px solid #ddd;
  font-size: 12px;

  div {
    width: 1164px;
    margin: 0 auto;
    padding: 10px 0px;
  }
}
.search {
  width: 100%;
  height: 58px;
  line-height: 58px;
  border-bottom: 1px solid #ddd;

  .search-box {
    width: 1164px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;

    .el-select {
      margin-top: 13px;
    }
  }
}
.main {
  width: 1164px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;

  ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;

    li {
      width: 266px;
      margin: 20px 0;

      img {
        width: 100%;
      }

      p {
        font-size: 16px;
      }
      .price {
        color: red;
      }
    }
  }
}
</style>
